package day0322;

import java.util.Random;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        for (int i = 1; i <= 3; i++) {//模拟出三道题
            int n1=(int)(Math.random()*50+1);
            int n2=(int)(Math.random()*50+1);
            int ope=(int)(Math.random()*4+1); //[1,5)
            switch (ope){
                case 1:  System.out.println(n1 +  "+" + n2 +"="); break;
                case 2:  System.out.println(n1 +  "-" + n2 +"="); break;
                case 3:  System.out.println(n1 +  "*" + n2 +"="); break;
                case 4:  System.out.println(n1 +  "/" + n2 +"="); break;
            }

            for (int j = 1; j <= 5; j++) {//模拟5个学生都回答此问题
                System.out.println("请第"+j+"号学生回答问题：");
                int answer=s.nextInt();
                switch (ope){
                    case 1:  System.out.println( ((n1 + n2)  ==answer)?"回答正确":"回答错误"); break;
                    case 2:  System.out.println( ((n1 - n2)  ==answer)?"回答正确":"回答错误"); break;
                    case 3:  System.out.println( ((n1 * n2)  ==answer)?"回答正确":"回答错误"); break;
                    case 4:  System.out.println( ((n1 / n2)  ==answer)?"回答正确":"回答错误"); break;
                }
            }
        }
    }
}
